﻿<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Bezdelnick
 * Date: 30.04.13
 * Time: 14:19
 * To change this template use File | Settings | File Templates.
 */
include("common/header.php");
include("dao/QuestionDao.php");

$questionDao = new QuestionDao();
$questions = null;
$index = 0;

if (
    isset($_POST['vote']) &&
    isset($_POST['status']) &&
    isset($_POST['group'])
) {
    echo "VOTE: " . $_POST['vote'] . "<br/>";
    echo "STATUS: " . $_POST['status'] . "<br/>";
    echo "GROUP: " . $_POST['group'] . "<br/>";

    $questions = $questionDao->loadByVoteId($_POST['vote']);
} else {
}
?>

<table style="width: 80%;">
    <thead>
    <tr>
        <th style="width: 10%;">#</th>
        <th style="width: 75%;">Question</th>
        <th style="width: 15%;">Answer</th>
    </tr>
    </thead>
    <tbody>
    <? foreach ($questions as $qst) { ?>
    <tr>
        <td><?= $index ?></td>
        <td><?= $qst->getQuestion() ?></td>
        <td>
            <select name="q_ans__<?= $qst->getId() ?>">
            <? for ($i = 1; $i <= 10; $i++) { ?>
                <option value="<?= $i ?>">
                    <?= $i ?>
                </option>
            <? } ?>
            </select>
        </td>
    </tr>
        <? $index++ ?>
        <? } ?>
    </tbody>
</table>

<? include("common/footer.php"); ?>